/*
 * Created by 岱青海蓝信息系统(北京)有限公司 on 17-6-14 下午4:11
 * Copyright (c) 2017. All rights reserved.
 */

package com.example.dqhl.jdmetro;

import android.app.Activity;
import android.app.Application;

import com.amap.api.location.AMapLocationClient;

import org.xutils.x;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by dqhl on 17/6/14.
 */
public class JDMetroApplication extends Application {
    public static JDMetroApplication mInstance = null;
    public static List<Activity> activities = new ArrayList<Activity>();

    //声明AMapLocationClient类对象
    public AMapLocationClient mLocationClient = null;
    @Override
    public void onCreate() {
        super.onCreate();
        mInstance = this;
        initXUtils();
        initAMap();
    }

    /**
     * 初始化 xUtils
     */
    private void initXUtils() {
        x.Ext.init(this);
        x.Ext.setDebug(true); // 是否输出debug日志
    }

    /**
     * 初始化高德地图
     */
    private void initAMap() {
        //初始化定位
        mLocationClient = new AMapLocationClient(getApplicationContext());
    }
    public static JDMetroApplication getInstance() {
        return mInstance;
    }


//    /**
//     * 添加Activity到容器中
//     *
//     * @param activity
//     */
//    public void addActivity(BaseActivity activity) {
//        if (!activities.contains(activity))
//            activities.add(activity);
//    }

//    /**
//     * 应用退出，结束所有的activity
//     */
//    public void exit() {
//        for (Activity activity : activities) {
//            if (activity != null) {
//                activity.finish();
//            }
//        }
//        System.exit(0);
//    }
}
